package com.tc.data.driver;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.ExceptionInterceptor;
import com.mysql.jdbc.exceptions.jdbc4.CommunicationsException;
import com.mysql.jdbc.exceptions.jdbc4.MySQLQueryInterruptedException;

import java.sql.SQLException;
import java.sql.SQLTimeoutException;
import java.util.Properties;

public class DataSeedExceptionInterceptor implements ExceptionInterceptor{ //数据库连接异常拦截器

	@Override
	public void init(Connection conn, Properties props) throws SQLException {
	}

	@Override
	public void destroy() {
	}

	@Override
	public SQLException interceptException(SQLException sqlEx, Connection conn) {
		//level
		if(sqlEx instanceof CommunicationsException){

		}else if(sqlEx instanceof SQLTimeoutException){

		}else if(sqlEx instanceof MySQLQueryInterruptedException){

		}
		return sqlEx;
	}
}
